package com.link.base.base.user.service;

import com.link.base.base.user.model.User;
import com.link.base.base.user.model.JWT;
import com.link.base.base.user.model.UserExperience;
import com.link.core.basic.service.BasicService;

import java.util.Map;

/**
 * 快速体验
 *
 * @author ouyangzhenqiang
 * @date 2018/12/27
 */
public interface UserExperienceService extends BasicService<UserExperience> {
    
    /**
     * 体验发送短信验证码
     * 
     * @author ouyangzhenqiang
     * @date 2018/12/27
     * @param record 
     */
    String sendSMSCode(UserExperience record) throws Exception;

    /**
     * 校验手机验证码
     *
     * @author ouyangzhenqiang
     * @date 2018/12/28
     * @param record
     */
    void checkSMSCode(UserExperience record) throws Exception;

    /**
     * 获取体验账号
     *
     * @author ouyangzhenqiang
     * @date 2018/12/28
     * @param record
     */
    User getBaseExperienceUser(UserExperience record) throws Exception;
    
    /**
     * 判断用户体验记录表是否已存在
     * 
     * @author ouyangzhenqiang
     * @date 2018/12/28
     */
    User checkExperienceUser(UserExperience record) throws Exception;

    /**
     * 创建体验账号
     *
     * @author ouyangzhenqiang
     * @date 2018/12/27
     * @param baseUser 已知用户
     * @param experience 体验信息
     */
    User generateExperienceUser(User baseUser, UserExperience experience) throws Exception;
    
    /**
     * 免密登录获取token
     * 
     * @author ouyangzhenqiang
     * @date 2018/12/28
     */
    JWT getToken(User record, String scope) throws Exception;

    /**
     * 体验账号模拟登录
     *
     * @author ouyangzhenqiang
     * @date 2018/12/27
     * @param record
     */
    Map<String, Object> experienceLogin(UserExperience record) throws Exception;

    /**
     * 免密码登录
     *
     * @author ouyangzhenqiang
     * @date 2019/1/2
     * @param record
     */
    UserExperience loginWithOutPassword(User record) throws Exception;

    /**
     * 生成随机验证码
     *
     * @author ouyangzhenqiang
     * @date 2018/12/27
     * @param num 随机码长度
     */
    String genSMSCode(int num) throws Exception;

    /**
     * 生成随机姓名
     *
     * @author ouyangzhenqiang
     * @date 2018/12/28
     */
    String genUserName() throws Exception;

    /**
     * 生成汉字
     *
     * @author ouyangzhenqiang
     * @date 2018/12/28
     */
    String getChinese() throws Exception;
}
